package com.dys.service.impl;

import com.dys.dao.StudentDao;
import com.dys.dao.impl.StudentDaoImpl;
import com.dys.entity.Student;
import com.dys.service.StudentService;

import java.util.List;

/**
 * @className: com.dys.service.impl.StudentServiceImpl
 * @description: com.dys.service.impl
 * @author: pine cone
 * @version: v1.0.0
 * @createTime: 2024/10/09 22:18
 */
public class StudentServiceImpl implements StudentService {
    private final StudentDao studentDao = new StudentDaoImpl();

    @Override
    public int saveStudent(Student student) {
        return studentDao.saveStudentInfo(student);
    }

    @Override
    public List<Student> findAllStudent(String name, String phone) {
        return studentDao.listStudentInfoByNameAndPhone(name, phone);
    }

    @Override
    public int findStudentCount() {
        return studentDao.selectStudentCount();
    }

    @Override
    public List<Student> findStudentByPage(int pageNo, int pageSize, String name, String phone) {
        return studentDao.selectStudentInfoByPage(pageNo, pageSize, name, phone);
    }

    @Override
    public int deleteOneStudent(int sid) {
        return studentDao.deleteOneStudentInfo(sid);
    }

    @Override
    public Student findOneStudent(int sid) {
        return studentDao.selectOneStudentInfo(sid);
    }

    @Override
    public int updateStudent(Student student) {
        return studentDao.updateStudentInfo(student);
    }
}
